<include file="/public/header" />
<!-- 重定位style -->
<style>
.layui-table-cell {height: 35px;line-height: 35px;}
.layui-table, .layui-table-view{margin-top: 0px;}
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layuiadmin-card-header-auto ">
        <div class="layui-form">
            <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-form-label">{:__('模型名称')}</div>
                <div class="layui-input-inline "><input name="model" class="layui-input" type="text" placeholder="{:__('模型名称')}"/></div>
            </div>
            <div class="layui-inline" >
                <!-- // 默认搜索 -->
                <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>
                    <i class="layui-icon layui-icon-search"></i>{:__('搜索')}
                </button>

                <!-- // 添加数据页面 -->
                <button class="layui-btn icon-btn" lay-open="" lay-title="{:__('添加模型')}" lay-area="580px,530px" lay-url="#editforms" >
                    <i class="layui-icon layui-icon-add-1"></i>{:__('添加')}
                </button>

            </div>
            </div>
        </div> 

        </div>

        <!-- // 创建数据表实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>        
    </div>
</div>

<!-- // 添加编辑数据 -->
<script type="text/html" id="editforms" >
<div class="layui-fluid layui-bg-white" >
    <form class="layui-form layui-form-fixed" lay-filter="editforms" >
    <input type="text" name="id" hidden="">
    <div class="layui-form-item">
        <label class="layui-form-label">{:__('模型名称')}</label>
        <div class="layui-input-block">
            <input name="title"  type="text" class="layui-input"  lay-verType="tips"/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">{:__('数据表名')}</label>
        <div class="layui-input-block">
            <input name="table"  type="text" class="layui-input" lay-verType="tips"/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">{:__('排&emsp;序')}</label>
        <div class="layui-input-block">
            <input name="sort"  type="text" class="layui-input" lay-verType="tips"/>
        </div>
    </div>   

    <div class="layui-form-item">
        <label class="layui-form-label">{:__('栏目模板')}</label>
        <div class="layui-input-block">
            <input name="skin" type="text" class="layui-input"  lay-verType="tips"/>
        </div>
    </div>   
    <div class="layui-form-item">
        <label class="layui-form-label">{:__('内容页模板')}</label>
        <div class="layui-input-block">
            <input name="skin_detail" type="text" class="layui-input"   lay-verType="tips"/>
        </div>
    </div> 

    <div class="layui-form-item">
        <label class="layui-form-label">{:__('子页面模版')}</label>
        <div class="layui-input-block">
            <input name="skin_child" type="text" class="layui-input" lay-verType="tips"/>
        </div>
    </div> 
    <div class="layui-form-item">
        <label class="layui-form-label">{:__('筛选页模板')}</label>
        <div class="layui-input-block">
            <input name="skin_type" type="text" class="layui-input" lay-verType="tips"/>
        </div>
    </div>  

    <div class="layui-footer layui-form-item layui-center">
        <button class="layui-btn layui-btn-primary" type="button" sa-event="closePageDialog" >{:__('取消')}</button>
        <button class="layui-btn" lay-add="{:url('/system.channel/add')}" lay-edit="{:url('/system.channel/edit')}" lay-filter="submitPage" lay-submit>{:__('提交')}</button>
    </div>
    </form>
</div>
</script>

<!-- // 列表编辑框 -->
<script type="text/html" id="tableBar"> 
    <a class="layui-table-text" lay-title="{:__('编辑')} {{d.title}}" lay-area="580px,530px" lay-url="#editforms" lay-event="edit" >{:__('编辑')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" lay-url="{:url('/system.channel/del/')}id/{{d.id}}" lay-event="del" >{:__('删除')}</a>
</script>
<include file="/public/footer" />
<script>
    layui.use(['admin','table'], function () {
        var jquery = layui.jquery;
        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            ,url: "{:url('/system.channel/index')}"
            ,cols: [[
                {type: 'checkbox', width:45},
                {field: 'id', align: 'center',sort: true,width: 80,  title: 'ID'},
                {field: 'title', align: 'left', title: '{:__("名称")}'},
                {field: 'table', align: 'center',width:130,title: '{:__("数据库表")}'},
                {field: 'skin', align: 'center',width:130,  title: '{:__("栏目模版")}'},
                {field: 'skin_detail', align: 'center',width:160, title: '{:__("内容页模板")}'},
                {field: 'skin_child', align: 'center', width:160, title: '{:__("子页面模板")}'},
                {field: 'skin_type', align: 'center', width:160, title: '{:__("筛选页模板")}'},
                {field: 'lasttime', align: 'center', width:160,templet: '<div>{{ layui.util.toDateString(d.lasttime*1000, "yyyy-MM-dd HH:mm:ss") }}</div>', title: '{:__("修改时间")}'},
                {field: 'createtime', align: 'center', width:160,templet: '<div>{{ layui.util.toDateString(d.createtime*1000, "yyyy-MM-dd HH:mm:ss") }}</div>', title: '{:__("创建时间")}'},
                {align: 'center', toolbar: '#tableBar', width:160, title: '{:__("操作")}'},
            ]]
        })

    })
</script>
